package com.witherest.server.controller.api;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import com.witherest.server.common.bean.ResponseCode;
import com.witherest.server.vo.response.CommonResponse;
import com.witherest.server.vo.response.DuplicationCheckResponse;

@Controller
@RequestMapping("/{requestType}/user")
public class UserController {
	private static final Logger logger = LoggerFactory.getLogger(UserController.class);
	
	/**
	 * 사용자 신규 가입
	 * 
	 * @return CommonResponse
	 * @throws Exception
	 */
	@RequestMapping(method = RequestMethod.POST)
	@ResponseBody
	public CommonResponse regist(@PathVariable String requestType,
            @RequestParam String userName, @RequestParam String userId, @RequestParam String userPw,
			@RequestParam String interestCategory) throws Exception {
		logger.debug("Regist User API In...");

        CommonResponse result = new CommonResponse(ResponseCode.SUCCESS);
        result.setRequestType(requestType);
		
		return result;
    }
	
	/**
	 * 신규 가입시 아이디 중복체크
	 * 
	 * @param userId
	 * @return DuplicationCheckResponse
	 * @throws Exception
	 */
	@RequestMapping(value = "/duplCheck", method = RequestMethod.GET)
	@ResponseBody
	public DuplicationCheckResponse duplicationCheck(@PathVariable String requestType,
            @RequestParam String userId) throws Exception {
		logger.debug("Duplication Check API In...");
		
		DuplicationCheckResponse result = new DuplicationCheckResponse(ResponseCode.SUCCESS);
		result.setIsDuplication("false");
        result.setRequestType(requestType);
		
		return result;
	}
}
